package com.qzsoft.zhjd.materiel.modules.materielapi.aop;

import lombok.Data;

/**
 * 平台对接接口返回数据
 */
@Data
public class ExtResult {

    private static Integer OK = 200;
    private static Integer ERROR = 201;
    private static Integer IGNORE = 202;
    private static Integer NOTFOUND = 203;

    private int code;

    private Object data;

    private Long version;

    public static ExtResult ok(Object data) {
        ExtResult result = new ExtResult();
        result.setCode(OK);
        result.setData(data);
        return result;
    }

    public static ExtResult ingnore() {
        ExtResult result = new ExtResult();
        result.setCode(IGNORE);
        return result;
    }

    public static ExtResult error() {
        ExtResult result = new ExtResult();
        result.setCode(ERROR);
        return result;
    }

    public static ExtResult notFound() {
        ExtResult result = new ExtResult();
        result.setCode(NOTFOUND);
        return result;
    }

}
